<script setup>

</script>

<template>
  <div class="tag-wrapper">
    <slot></slot>
    <button type="button" class="clear-button" @click="$emit('onClose')">
      <div class="icon-cancel"></div>
    </button>
  </div>
</template>

<style scoped lang="scss">
.tag-wrapper {
  padding: 1px 0 1px 6px;
  background-color: var(--bgc-04);
  border: 1px  solid var(--border-primary);
  border-radius: 2px;
  height: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;

  &:hover .clear-button {
    visibility: visible;
  }
}

.clear-button {
  background: transparent;
  border: 0;
  padding: 0 2px;
  visibility: hidden;

  &:hover .icon {
    background-color: red;
  }
}

.icon-cancel {
  mask-repeat: no-repeat;
  mask-position: center;
  vertical-align: middle;
  margin: auto;
  display: inline-block;
  background-color: var(--icon-bgc);
  width: 18px;
  height: 18px;
  mask-image: url('/static/svg/cancel.svg');
  transition: background-color 0.3s ease-in-out;

  &:hover {
    background-color: var(--color-orange);
  }
}
</style>
